{extend name="public/common"} {block name="body"}
<title>分类管理</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    彩票管理
    <span class="c-gray en">&gt;</span>
    分类管理
    <a class="btn btn-success radius r"
       style="line-height: 1.6em; margin-top: 3px"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>


<div style="padding:20px;height:30px;">
  	
  	<div class="new_box">
<div class="page-container" style="padding-top:10px;">
    <div id="tab-system" class="HuiTab">
        <div class="tabCon">
            <div class="mt-20">
                <table
                        class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
                    <thead>
                    <tr class="text-c">
                        <th>ID</th>
                        <th>分类名字</th>
                        <th>彩种信息</th>
                        <th>标识</th>
                        <th>返点</th>
                        <th>状态</th>
                        <th>顺序</th>
                    </tr>
                    </thead>
                    {volist name="list" id="val"}
                    <tbody>
                    <tr class="text-c">
                        <td>{$val.id}</td>
                        <td>{$val.class_name_lottery}</td>
                        <td>{$val.lottery}</td>
                        <td>{$val.class_sign}</td>
                        <td>{$val.fandian}</td>
                        <td>
                            <span >{$val.status==1 ? '已开启' : '已关闭'}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                            <button style="color: red;cursor:pointer;width:25px;" onclick="changeStatus('{$val.id}',this)" data-status="{$val.status}" >{$val.status==1 ? '关' : '开'}</button>
                        </td>
                        <td><input type="text" value="{$val.sorting}" onblur="changeSort('{$val.id}',this)" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</div>
</div>

{/block}{block name="js"}
<script type="text/javascript" src="__SYSMET__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
    $(function() {
        $('.skin-minimal input').iCheck({
            checkboxClass : 'icheckbox-blue',
            radioClass : 'iradio-blue',
            increaseArea : '20%'
        });
        $("#tab-system").Huitab({
            index : 0
        });
    });
</script>
<script type="text/javascript">
    function changeStatus(id,obj){
        var status = $(obj).data('status');
        var change = 1-parseInt(status);
        $.ajax({
            type : "post",
            url : "{:url('lottery/changeCategoryStatus')}",
            data : {"id":id,"change":change},
            success: function (data) {
                if( 1==parseInt(data) ){
                    $(obj).data('status',change);
                    if( 0==change ){
                        $(obj).html("开");
                        location.replace(location.href);
                    }else {
                        $(obj).html("关");
                        location.replace(location.href);
                    }
                }else{
                    layer.msg('更新失败!', {icon: 5});
                }
            }
        });
    }
    function changeSort(id,obj){
        var sort = $(obj).val();
        $.ajax({
            type : "post",
            url : "{:url('lottery/changeCategorySort')}",
            data : {"id":id,"sort":sort},
            success: function (data) {
                if( 1==parseInt(data) ){
                    layer.msg('更新成功!', {icon: 1});
                }else{
                    layer.msg('更新失败!', {icon: 5});
                }
            }
        });
    }
</script>
{/block}
